package com.object.config;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author 15784
 */
@Component
public class StartupCheck implements ApplicationListener<ApplicationReadyEvent> {
    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        if (!checkEnvironment()) {
            throw new IllegalStateException("授权失败，应用无法启动");
        }
    }

    private boolean checkEnvironment() {
        // 你的检查逻辑
        //todo  授权配置

        // 如果所有检查通过，返回true；否则返回false
        return true;
    }
}